package com.yuxi.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.yuxi.modelExt.BaseInfoExt;
import com.yuxi.dao.IBaseInfoDao;
import com.yuxi.searchExt.BaseInfoSearchExt;
import com.yuxi.pubInter.IBaseDao;
import com.yuxi.pubInter.AbstractBaseService;
import com.yuxi.service.IBaseInfoService;
import lombok.extern.slf4j.Slf4j;
import com.yuxi.common.StringUtil;
import com.yuxi.common.SkList;
import com.yuxi.pubInter.exception.SkException;


/**
*    @author sunke
*    @Date 2023-10-13 10:05:03
*    @description BaseInfoService      基础信息
*/
@Service(value = "baseInfoService")
@Slf4j
public class BaseInfoServiceImpl extends AbstractBaseService<BaseInfoExt, BaseInfoSearchExt,String> implements IBaseInfoService {

    @Resource(name = "baseInfoDao")
    private IBaseInfoDao baseInfoDao;

    @Override
    public IBaseDao<BaseInfoExt, BaseInfoSearchExt,String> getDao() {
        return baseInfoDao;
    }


    @Override
    public BaseInfoExt getDetail(String id) throws SkException {
        return detail();
    }

    @Override
    public BaseInfoExt detail() {
        try {
            BaseInfoSearchExt search = BaseInfoSearchExt.getInstance();
            BaseInfoExt baseInfo = getDetailBySearch(search);
            if (StringUtil.isNotObjEmpty(baseInfo)) {
                return baseInfo;
            }
            baseInfo = new BaseInfoExt();

            return insert(baseInfo);
        } catch (SkException e) {
            e.printStackTrace();

        }
        return null;
    }
}